From 24e0ec86ef2019891b5151922288a7a932efd327 Mon Sep 17 00:00:00 2001 From: parkrrrr Date: Tue, 13 Dec 2005 15:11:32 +0000 Subject: [PATCH] Added 'circle' type and 'radius' option to an1 --- gpsbabel/an1.c | 32 ++++++++++++++++++++++++++------ gpsbabel/readme.xml | 8 ++++++-- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/gpsbabel/an1.c b/gpsbabel/an1.c index 394922182..79613fcf4 100644 --- a/gpsbabel/an1.c +++ b/gpsbabel/an1.c @@ -36,11 +36,14 @@ static char *opt_symbol = NULL; static char *opt_color = NULL; static char *opt_zoom = NULL; static char *opt_wpt_type = NULL; +static char *opt_radius = NULL; + static short output_type_num = 0; static short opt_zoom_num = 0; static long opt_color_num = 0; static short wpt_type_num = 0; static short last_read_type = 0; +static double radius = 0.0; static long serial=10000; static long rtserial=1; @@ -66,8 +69,11 @@ arglist_t an1_args[] = { "red", ARGTYPE_STRING }, {"zoom", &opt_zoom, "Zoom level to reduce points", NULL, ARGTYPE_INT }, - {"wpt_type", &opt_wpt_type, "Waypoint type (marker,text,mapnote)", + {"wpt_type", &opt_wpt_type, + "Waypoint type (marker,text,mapnote,circle)", "", ARGTYPE_STRING }, + {"radius", &opt_radius, "Radius for circles", + NULL, ARGTYPE_STRING }, {0, 0, 0, 0 } }; @@ -239,7 +245,7 @@ typedef struct { unsigned char create_zoom; unsigned char visible_zoom; short unk5; - double radius; + double radius; /* in km */ char *name; char *fontname; GUID guid; @@ -286,6 +292,7 @@ typedef struct { static an1_waypoint_record *Alloc_AN1_Waypoint( ); void Destroy_AN1_Waypoint( void *vwpt ) { + an1_waypoint_record *wpt = (an1_waypoint_record *)vwpt; xfree( wpt->name ); xfree( wpt->fontname ); @@ -619,9 +626,9 @@ Write_One_AN1_Waypoint( const waypoint *wpt ) an1_waypoint_record *rec; int local; format_specific_data *fs = NULL; + waypoint *wpt2 = (waypoint *)(void *)wpt; fs = fs_chain_find( wpt->fs, FS_AN1W ); - if ( fs ) { rec = (an1_waypoint_record *)fs; xfree( rec->name ); @@ -636,9 +643,10 @@ Write_One_AN1_Waypoint( const waypoint *wpt ) rec->type = wpt_type_num; rec->unk2 = 3; rec->unk3 = 18561; - rec->radius = 528; + rec->radius = radius; rec->fillcolor = opt_color_num; rec->fillflags = 3; + if ( wpt_type_num == 5 ) rec->fillflags = 0x8200; rec->height = -50; rec->width = 20; rec->fontname = xstrdup( "Arial" ); @@ -748,6 +756,7 @@ Write_One_AN1_Line( const route_head *rte ) an1_line_record *rec; int local; format_specific_data *fs = NULL; + route_head *rte2 = (route_head *)(void *)rte; fs = fs_chain_find( rte->fs, FS_AN1L ); @@ -846,6 +855,7 @@ Write_One_AN1_Vertex( const waypoint *wpt ) an1_vertex_record *rec; int local; format_specific_data *fs = NULL; + waypoint *wpt2 = (waypoint *)(void *)wpt; fs = fs_chain_find( wpt->fs, FS_AN1V ); @@ -882,7 +892,7 @@ Init_Wpt_Type( void ) wpt_type_num = 1; /* marker */ return; } - if ((output_type[0] & 0xf0) == 0x30) { + if ((opt_wpt_type[0] & 0xf0) == 0x30) { wpt_type_num = atoi( opt_wpt_type ); } else { @@ -896,9 +906,12 @@ Init_Wpt_Type( void ) else if ( !case_ignore_strcmp( opt_wpt_type, "mapnote" )) { wpt_type_num = 6; } + else if ( !case_ignore_strcmp( opt_wpt_type, "circle" )) { + wpt_type_num = 5; + } else { fatal( MYNAME ": wpt_type must be " - "marker, text, or mapnote\n" ); + "marker, text, mapnote, or circle\n" ); } } } @@ -1074,6 +1087,13 @@ wr_init(const char *fname) if ( opt_zoom ) { opt_zoom_num = atoi(opt_zoom); } + radius = .1609344; /* 1/10 mi */ + if ( opt_radius ) { + radius = atof(opt_radius); + if ( !strchr(opt_radius,'k') && !strchr(opt_radius,'K')) { + radius *= 5280*12*2.54/100000; + } + } } static void diff --git a/gpsbabel/readme.xml b/gpsbabel/readme.xml index 2109fd54f..1095bb823 100644 --- a/gpsbabel/readme.xml +++ b/gpsbabel/readme.xml @@ -217,8 +217,12 @@ line or mapnote data. It accepts color names of the form "#FF0000" (red) or any of the 16 common color names from the Cascading Style Sheets specification.i The "wpt_type" option specifies how to represent point data -in the draw file. Valid waypoint types are "marker", "text", and "mapnote". -The default is "marker". +in the draw file. Valid waypoint types are "marker", "text", "mapnote", +and "circle". The default is "marker". + If the waypoint type is "circle", the "radius" option specifies +the radius of the circles. By default, this is in miles, but it may be +specified in kilometers by adding a 'k'. The default radius is 1/10 mile. + The "zoom" option specifies at what zoom level Street Atlas will begin showing reduced versions of your symbols. The default is 10. Setting zoom to 0 will disable this feature. Setting it to -- 2.30.2